<?php

use App\Http\Controllers\api\DomainController;
use App\Http\Controllers\api\DwzController;
use App\Http\Controllers\api\ForwardController;
use App\Http\Controllers\Api\UserController;
use App\Http\Controllers\MailController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

//需要验证的路由
Route::middleware('auth:api')->group(function () {
    Route::post('/forward/add', [ForwardController::class, 'add']);
    Route::post('/forward/edit/{forward_id}', [ForwardController::class, 'edit']);
    Route::post('/forward/del/{forward_id}', [ForwardController::class, 'del']);

    Route::post('/domain/add', [DomainController::class, 'add']);
    Route::post('/domain/edit/{domain_id}', [DomainController::class, 'edit']);
    // Route::post('/domain/del/{domain_id}', [DomainController::class, 'del']);

    Route::post('/dwz/add/{domian_id}', [DwzController::class, 'add']);
    Route::post('/dwz/edit/{dwz_id}', [DwzController::class, 'edit']);
    Route::post('/dwz/del/{dwz_id}', [DwzController::class, 'del']);
    
    Route::post('/user/vip/Upgrade', [UserController::class, 'vip_Upgrade']);
    Route::post('/user/forward/exchange', [UserController::class, 'forward_exchange']);
    Route::post('/user/password/update', [UserController::class, 'updatePassword']);
});
Route::post('/dwz/{domain_id}', [DwzController::class, 'dwz']);
//邮箱验证
Route::post('/email/verify', [MailController::class, 'sendVerifyEmail']);
//域名验证
Route::any('/domain/verify', [ForwardController::class, 'verify']);

